<template>
  <div class="modern-page error-page">
    <div class="error-content modern-card modern-slide-in">
      <div class="error-icon modern-float">
        <component :is="'LockIcon'" />
      </div>
      <div class="error-code modern-text-gradient error-code-403">403</div>
      <div class="error-title">访问被拒绝</div>
      <div class="error-description">
        抱歉，您没有权限访问此页面或资源
      </div>
      <div class="permission-info">
        <div class="permission-item">
          <component :is="'InfoIcon'" />
          <span>请联系管理员获取相应权限</span>
        </div>
        <div class="permission-item">
          <component :is="'ShieldIcon'" />
          <span>当前用户权限不足</span>
        </div>
      </div>
      <div class="error-actions">
        <t-button 
          theme="primary" 
          size="large"
          class="modern-btn-enhance"
          @click="goHome"
        >
          <template #icon>
            <component :is="'HomeIcon'" />
          </template>
          返回首页
        </t-button>
        <t-button 
          variant="outline" 
          size="large"
          @click="goBack"
        >
          <template #icon>
            <component :is="'ChevronLeftIcon'" />
          </template>
          返回上页
        </t-button>
        <t-button 
          variant="text" 
          size="large"
          @click="requestPermission"
        >
          <template #icon>
            <component :is="'MailIcon'" />
          </template>
          申请权限
        </t-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { MessagePlugin } from 'tdesign-vue-next'

const router = useRouter()

const goHome = () => {
  router.push('/dashboard')
}

const goBack = () => {
  router.go(-1)
}

const requestPermission = () => {
  MessagePlugin.info('权限申请功能开发中...')
}
</script>

<style lang="scss" scoped>
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #fc7f7f 0%, #ff9a8b 100%);
}

.error-content {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 500px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.error-icon {
  font-size: 4rem;
  color: #ef4444;
  margin-bottom: 1.5rem;
  animation: shake 1s infinite;
}

.error-code-403 {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 7.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 1.25rem;
  letter-spacing: -0.05em;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.75rem;
}

.error-description {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.permission-info {
  background: rgba(254, 243, 199, 0.8);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-left: 4px solid #f59e0b;
}

.permission-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  color: #92400e;
  font-size: 0.9rem;
  
  &:last-child {
    margin-bottom: 0;
  }
  
  svg {
    font-size: 1.25rem;
    flex-shrink: 0;
  }
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

:deep(.t-button) {
  border-radius: 12px;
  height: 3rem;
  padding: 0 1.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

:deep(.t-button--theme-primary) {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
}

:deep(.t-button--theme-primary:hover) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.4);
}

:deep(.t-button--variant-outline) {
  border: 2px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(5px);
}

:deep(.t-button--variant-outline:hover) {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

:deep(.t-button--variant-text) {
  background: transparent;
  color: #6b7280;
}

:deep(.t-button--variant-text:hover) {
  background: rgba(107, 114, 128, 0.1);
  color: #374151;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

// 响应式设计
@media (max-width: 640px) {
  .error-content {
    padding: 2rem 1.5rem;
  }
  
  .error-code-403 {
    font-size: 5rem;
  }
  
  .permission-info {
    padding: 1rem;
  }
  
  .error-actions {
    flex-direction: column;
    align-items: center;
    
    :deep(.t-button) {
      min-width: 200px;
    }
  }
}
</style> 